﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XLang;

namespace ALang.AST
{
    /// <summary>
    /// 模块标识符
    /// </summary>
    public class ModuleIdentifierAST : XLang.AST
    {
        public string Text { get; set; }

        [ReduceCondtion(typeof(Module))]
        [ReduceCondtion(typeof(Import))]
        public static ModuleIdentifierAST Rule(Identifier identifier)
        {
            var ast = new ModuleIdentifierAST() { Text = identifier.Text };
            return ast;
        }

        public static ModuleIdentifierAST Rule(ModuleIdentifierAST moduleIdentifierAST, Dot dot, Identifier identifier)
        {
            moduleIdentifierAST.Text += "." + identifier.Text;
            return moduleIdentifierAST;
        }
    }
}
